import { createRouter, createWebHistory,createWebHashHistory } from 'vue-router'
import Home from '../views/Home/Home.vue'
import Address from '../views/address/Address.vue'
import Edit from '../views/edit/Edit.vue'

import Child1 from '../views/Home/Child1/Child1.vue'
import Child2 from '../views/Home/Child2/Child2.vue'
import Child3 from '../views/Home/Child3/Child3.vue'
import NotFound from '../views/404.vue'
const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: '/',
      name: 'home',
      component: Home,
      redirect:'/child1',
      children:[
        {
          path: '/child1',
          name: 'child1', 
          component: Child1,
        },
        {
          path: '/child2',
          name: 'child2',
          component: Child2,
        },
        {
          path: '/child3',
          name: 'child3',
          component:Child3,
        }
      ],
    },
    {
      path: '/detail/:id',
      name: 'detail',
      component: () => import('../views/detail/Detail.vue'),
    },
    {
      path: '/address',
      name: 'address',
      component: Address,
    },
    {
      path: '/address/edit',
      name: 'edit',
      component: Edit,
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/Login/Login.vue'),
    },
    { path: '/:pathMatch(.*)*', 
      name: 'NotFound', 
      component: NotFound 
    },
  ],
})

export default router
